package com.xianyv.common;

import lombok.Data;

@Data
public class Result<T> {

    private Integer code;
    private String message;

    private  T data;

    public Result() {
    }

    public Result(Integer code, T data) {
        this.code = code;
        this.data = data;
    }

    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public static<T> Result<T> success(T Object){

        return new Result<T>(Code.SUCCESS,Object);
    }

    public static<T> Result<T> error(String message){

        return new Result<T>(Code.ERROR,message,null);
    }


}
